﻿<div id="DialogDiv" title="Dialog" style="display: none;">
</div>


<script type="text/javascript">
    function openDialog(action, widthx) {

        $.ajax({
            type: "GET",
            url: action,
            cache: false,
            dataType: 'html',
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $("#DialogDiv").html(errorThrown);
            },
            success: function (data, textStatus, XMLHttpRequest) {
                $("#DialogDiv").html(data);
            },
            complete: function (XMLHttpRequest, textStatus) {

                $('#DialogDiv').dialog({
                    modal: true,
                    width: widthx + "px",
                    close: function (event, ui) { $("#DialogDiv").html(""); },
                    buttons: {
                        "Ok": function () { $(this).dialog("close"); }
                    }
                });
            }
        });
    }
</script>